﻿Public Class SaveForm

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'Закрытие
        Me.Visible = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Сохранение в файл
        SaveFileDialog1.Filter = "sql (*.sql)|*.sql"
        SaveFileDialog1.ShowDialog()
        If SaveFileDialog1.FileName <> "" Then
            FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
            PrintLine(1, TextBox1.Text)
            FileClose(1)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Добавление сгенерированного запроса
        Dim i As String
        i = Form1.TextBox4.Text
        TextBox1.Text = TextBox1.Text & " " & i + vbCrLf
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        'Очистка поля
        TextBox1.Text = ""
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        'Комментарии
        Dim comm As String
        comm = InputBox("Введите комментарий:", "Введите комментарий")
        TextBox1.Text = TextBox1.Text & "# " & comm + vbCrLf
    End Sub
End Class